﻿using System;
using System.Collections;

namespace YArchitech.HCLoad.XmlData
{
	public class SysZoneCollect : Hashtable
	{
		public SysZoneCollect(Room room)
		{
			this.parent = room;
		}

		public Room Parent
		{
			get
			{
				return this.parent;
			}
			set
			{
				this.parent = value;
			}
		}

		public int AddSysZoneRoom(SysZoneRoom sysZoneRoom)
		{
			int result;
			try
			{
				int id = sysZoneRoom.ID;
				sysZoneRoom.Parent = this;
				this.Add(id, sysZoneRoom);
				result = id;
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		public void RemoveSysZoneRoom(int ID)
		{
			try
			{
				this.Remove(ID);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public SysZoneRoom GetSysZoneRoom(int ID)
		{
			SysZoneRoom result;
			try
			{
				result = (SysZoneRoom)this[ID];
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		private Room parent;
	}
}
